package cn.daomeng.firebird.core.handler;

import java.io.IOException;
import java.util.UUID;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

import cn.daomeng.firebird.core.constant.FirebirdContents;

/**
 * 平台统一Filter
 * @author wf.shu
 * @version 1.0.0.0
 * @since 2019-03-13 13:02
 */
public class FirebirdCoreFileter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        //doNothing...
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        servletRequest.setAttribute(FirebirdContents.USER_REQUEST_HEAD_ID, UUID.randomUUID());
    }

    @Override
    public void destroy() {
        //doNothing...
    }
}
